import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:meal/constant/antd_icons.dart';
import 'package:meal/constant/sizes.dart';
import 'package:meal/route/route.dart';
import 'package:meal/utils/colors.dart';
import 'package:meal/utils/styles.dart';
import 'package:meal/utils/tools.dart';

///
/// 团购套餐
///
class GroupPackage extends StatefulWidget {
  const GroupPackage({Key? key}) : super(key: key);

  @override
  State<GroupPackage> createState() => _GroupPackageState();
}

class _GroupPackageState extends State<GroupPackage> {
  double get leftWidth {
    return Sizes.default90;
  }

  double get rowHeight {
    return Sizes.default60;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: ToolsUtils.getDefaultBackgroundColor(),
      appBar:
          ToolsUtils.getDefaultBrnAppBar('团购套餐', actions: ToolsUtils.actions('确定', pressed: () {})),
      body: SingleChildScrollView(
        child: Column(
          children: [
            Container(
              margin: const EdgeInsets.only(top: Sizes.default10),
              padding: const EdgeInsets.all(Sizes.default15),
              child: Column(
                children: [
                  Container(
                    height: rowHeight,
                    alignment: Alignment.centerLeft,
                    child: Row(
                      children: [
                        Container(
                          width: leftWidth,
                          alignment: Alignment.centerLeft,
                          child: Text('中文标签',
                              style: StylesUtils.customTextStyle(
                                  fontSize: Sizes.default15, color: ColorsUtils.color333)),
                        ),
                        Expanded(
                            child: Container(
                          height: Sizes.default45,
                          padding: const EdgeInsets.symmetric(horizontal: Sizes.default10),
                          decoration: BoxDecoration(
                              color: ColorsUtils.rgba(247, 247, 247, 1),
                              borderRadius:
                                  const BorderRadius.all(Radius.circular(Sizes.default10))),
                          child: TextField(
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color363, fontSize: Sizes.default15),
                            decoration: InputDecoration(
                                border: const OutlineInputBorder(
                                  borderSide: BorderSide.none,
                                ),
                                isCollapsed: true,
                                filled: true,
                                fillColor: Colors.transparent,
                                contentPadding: const EdgeInsets.symmetric(
                                    horizontal: Sizes.default10, vertical: Sizes.default10),
                                constraints: const BoxConstraints(minHeight: Sizes.default45),
                                hintText: '如烤肉双人套餐',
                                hintStyle: StylesUtils.customTextStyle(
                                    fontSize: Sizes.default14, color: ColorsUtils.color999)),
                            controller: ToolsUtils.editingController('主菜 · 4选2'),
                            keyboardType: TextInputType.text,
                            onChanged: (String content) {},
                          ),
                        ))
                      ],
                    ),
                  ),
                  Container(
                    height: rowHeight,
                    alignment: Alignment.centerLeft,
                    child: Row(
                      children: [
                        Container(
                            width: leftWidth,
                            alignment: Alignment.centerLeft,
                            child: Text('商品明细',
                                style: StylesUtils.customTextStyle(
                                    fontSize: Sizes.default15, color: ColorsUtils.color333))),
                        Expanded(
                          child: InkWell(
                            child: Container(
                              height: Sizes.default45,
                              padding: const EdgeInsets.symmetric(horizontal: Sizes.default10),
                              alignment: Alignment.centerLeft,
                              decoration: BoxDecoration(
                                  color: ColorsUtils.rgba(247, 247, 247, 1),
                                  borderRadius:
                                      const BorderRadius.all(Radius.circular(Sizes.default10))),
                              child: Row(
                                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                children: [
                                  Text('添加商品',
                                      style: StylesUtils.customTextStyle(
                                          fontSize: Sizes.default15, color: ColorsUtils.color797)),
                                  BrunoTools.getAssetSizeImage(BrnAsset.iconRightArrow, 16, 16)
                                ],
                              ),
                            ),
                            onTap: () {
                              Get.toNamed(RouteGet.groupCommodity);
                            },
                          ),
                        ),
                      ],
                    ),
                  ),
                  Container(
                    decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(Sizes.default5),
                        border: Border.all(color: ColorsUtils.rgba(228, 228, 228, 1))),
                    padding: const EdgeInsets.symmetric(
                        vertical: Sizes.default10, horizontal: Sizes.default15),
                    child: Column(
                      children: [
                        Container(
                          alignment: Alignment.centerLeft,
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Text.rich(TextSpan(children: [
                                TextSpan(
                                    text: '·  火焰牛排',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color333, fontSize: Sizes.default13)),
                                TextSpan(
                                    text: '（1份）',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color999, fontSize: Sizes.default13))
                              ])),
                              Text.rich(TextSpan(children: [
                                TextSpan(
                                    text: '￥280  ',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color797, fontSize: Sizes.default13)),
                                WidgetSpan(
                                    child: Icon(AntdIcons.delete,
                                        size: Sizes.default15,
                                        color: ColorsUtils.parseColorFromHexString(
                                            ColorsUtils.colorFf0)),
                                    alignment: PlaceholderAlignment.middle)
                              ]))
                            ],
                          ),
                        ),
                        Container(
                          alignment: Alignment.centerLeft,
                          margin: const EdgeInsets.only(top: Sizes.default20),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Text.rich(TextSpan(children: [
                                TextSpan(
                                    text: '·  香烤鸡肉披萨',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color333, fontSize: Sizes.default13)),
                                TextSpan(
                                    text: '（1份）',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color999, fontSize: Sizes.default13))
                              ])),
                              Text.rich(TextSpan(children: [
                                TextSpan(
                                    text: '￥380  ',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color797, fontSize: Sizes.default13)),
                                WidgetSpan(
                                    child: Icon(AntdIcons.delete,
                                        size: Sizes.default15,
                                        color: ColorsUtils.parseColorFromHexString(
                                            ColorsUtils.colorFf0)),
                                    alignment: PlaceholderAlignment.middle)
                              ]))
                            ],
                          ),
                        ),
                        Container(
                          alignment: Alignment.centerLeft,
                          margin: const EdgeInsets.only(top: Sizes.default20),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Text.rich(TextSpan(children: [
                                TextSpan(
                                    text: '·  西冷牛排',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color333, fontSize: Sizes.default13)),
                                TextSpan(
                                    text: '（1份）',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color999, fontSize: Sizes.default13))
                              ])),
                              Text.rich(TextSpan(children: [
                                TextSpan(
                                    text: '￥780  ',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color797, fontSize: Sizes.default13)),
                                WidgetSpan(
                                    child: Icon(AntdIcons.delete,
                                        size: Sizes.default15,
                                        color: ColorsUtils.parseColorFromHexString(
                                            ColorsUtils.colorFf0)),
                                    alignment: PlaceholderAlignment.middle)
                              ]))
                            ],
                          ),
                        ),
                        Container(
                          alignment: Alignment.centerLeft,
                          margin: const EdgeInsets.only(top: Sizes.default20),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Text.rich(TextSpan(children: [
                                TextSpan(
                                    text: '·  菲力牛排',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color333, fontSize: Sizes.default13)),
                                TextSpan(
                                    text: '（1份）',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color999, fontSize: Sizes.default13))
                              ])),
                              Text.rich(TextSpan(children: [
                                TextSpan(
                                    text: '￥180  ',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color797, fontSize: Sizes.default13)),
                                WidgetSpan(
                                    child: Icon(AntdIcons.delete,
                                        size: Sizes.default15,
                                        color: ColorsUtils.parseColorFromHexString(
                                            ColorsUtils.colorFf0)),
                                    alignment: PlaceholderAlignment.middle)
                              ]))
                            ],
                          ),
                        ),
                        Container(
                          alignment: Alignment.centerLeft,
                          margin: const EdgeInsets.only(top: Sizes.default20),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Text.rich(TextSpan(children: [
                                TextSpan(
                                    text: '·  黄标牛排',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color333, fontSize: Sizes.default13)),
                                TextSpan(
                                    text: '（1份）',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color999, fontSize: Sizes.default13))
                              ])),
                              Text.rich(TextSpan(children: [
                                TextSpan(
                                    text: '￥380  ',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color797, fontSize: Sizes.default13)),
                                WidgetSpan(
                                    child: Icon(AntdIcons.delete,
                                        size: Sizes.default15,
                                        color: ColorsUtils.parseColorFromHexString(
                                            ColorsUtils.colorFf0)),
                                    alignment: PlaceholderAlignment.middle)
                              ]))
                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
                  Container(
                    height: rowHeight,
                    alignment: Alignment.centerLeft,
                    child: Row(
                      children: [
                        Container(
                            width: leftWidth,
                            alignment: Alignment.centerLeft,
                            child: Text.rich(TextSpan(children: [
                              TextSpan(
                                text: '商品价值',
                                style: StylesUtils.customTextStyle(color: ColorsUtils.color333),
                              ),
                            ]))),
                        Expanded(
                            child: Container(
                              height: Sizes.default45,
                              padding: const EdgeInsets.symmetric(horizontal: Sizes.default10),
                              margin: const EdgeInsets.only(right: Sizes.default15),
                              decoration: BoxDecoration(
                                  color: ColorsUtils.rgba(247, 247, 247, 1),
                                  borderRadius:
                                  const BorderRadius.all(Radius.circular(Sizes.default10))),
                              child: TextField(
                                style: StylesUtils.customTextStyle(
                                    color: ColorsUtils.color363, fontSize: Sizes.default15),
                                decoration: InputDecoration(
                                    border: const OutlineInputBorder(
                                      borderSide: BorderSide.none,
                                    ),
                                    isCollapsed: true,
                                    filled: true,
                                    fillColor: Colors.transparent,
                                    contentPadding: const EdgeInsets.symmetric(
                                        horizontal: Sizes.default10, vertical: Sizes.default10),
                                    constraints: const BoxConstraints(minHeight: Sizes.default45),
                                    hintText: '例如900',
                                    hintStyle: StylesUtils.customTextStyle(
                                        fontSize: Sizes.default14, color: ColorsUtils.color999)),
                                keyboardType: TextInputType.number,
                                onChanged: (String content) {},
                              ),
                            )),
                        Container(
                          alignment: Alignment.centerRight,
                          child: Text('￥',
                              style: StylesUtils.customTextStyle(color: ColorsUtils.color333)),
                        )
                      ],
                    ),
                  ),
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}
